import os
from django.conf.urls.defaults import *
from django.conf import settings

urlpatterns = patterns('',
    (r'^', include('chat.urls')),
)

if settings.DEBUG:
    for name in settings.INSTALLED_MODULES:
        urlpatterns += patterns('',
            (r'^.*pcdm_static/%s/(?P<path>.*)$' % name, 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'modules/%s/static' % name).replace('\\','/')}),
        )
    urlpatterns += patterns('',
        (r'^.*pcdm_static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'global/static').replace('\\','/')}),
    )

for name in settings.INSTALLED_MODULES:
    urlpatterns += patterns('', (r'%s' % name, include('modules.%s.urls' % name)))
